﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.TenderBond
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt.TenderBond;
    public class Map_TenderBondBackApproval : EntityMapping<TenderBondBackApproval>
    {
        public Map_TenderBondBackApproval()
        {
            Property(x => x.BackType);
            Property(x => x.ContentForBMJL, map => map.Length(1000000));
            Property(x => x.ContentForCWCN, map => map.Length(1000000));
            Property(x => x.ContentForCWJL, map => map.Length(1000000));
            Property(x => x.Remark, map => map.Length(1000000));
            Property(x => x.SPDate);
            Property(x => x.SPDescribe, map => map.Length(1000000));
            Property(x => x.SPFlag);
            Property(x => x.Title, map => map.Length(200));

            ManyToOne(x => x.Project, map =>
            {
                map.Column("ProjectId");
            });

            ManyToOne(x => x.OpUser, map =>
            {
                map.Column("OpUserId");
            });

            ManyToOne(x => x.Attachment, map =>
            {
                map.Column("AttachmentId");
            });

            ManyToOne(x => x.ApprovalRecord, map =>
            {
                map.Column("ApprovalRecordId");
            });

            Bag(x => x.Details, map =>
            {
                map.Key(keyMapper => keyMapper.Column("BackId"));
                map.Cascade(Cascade.None);
            }, rel => rel.OneToMany());

        }
    }
}
